// 加载mockjs库
import Mock from 'mockjs'
import cloud from './cloud'
// 构建一个函数对象，返回mock数据
const CloudInfo = function () {
  let data = {
    "msg": "success",
    "result": [

      {
        "instanceId": "1",
        "cloudName": "全部"
      }, {
        "instanceId": "600da240e4b0fbef100d80ef",
        "cloudName": "省医VMware"
      },
      // {
      //   "instanceId": "600ef332980ebd35da61cc64",
      //   "cloudName": "汕头灾备云"
      // },
      // {
      //   "instanceId": "600da240e4b0fbef100d79012",
      //   "cloudName": "电子政务云"
      // },
      {
        "instanceId": "6011b81de4b05cbf63964f76",
        "cloudName": "政务改造云"
      }, {
        "instanceId": "60b7ad77d5de5f999da19331",
        "cloudName": "湛江政务云"
      },
      // {
      //   "instanceId": "601f4cf0e4b004973721c1bf",
      //   "cloudName": "网办云"
      // },
      // {
      //   "instanceId": "60b7ad77d5de5f999da19a67",
      //   "cloudName": "腾讯云测试"
      // }
    ],
    "code": 0
  }
  // 此处省略对data的一系列运算
  return {
    data: data
  }
}


const vmwareInfo = function () {
  let data = {
    "msg": "success",
    "result": {
      "resourcesUse": {
        "storgeCapacitySize": 551162.25, // 存储容量
        "hostCpuCount": 864.0, //cpu梳理
        "hostMemSize": 19150.2, // 内存容量
        "vmCpuCount": 1612.0, //  虚拟机CPU数量
        "vmDiskSize": 321778.6, //	虚拟机磁盘
        "vmMemSize": 7363024.0, //虚拟机内存
        "storgeFreeSize": 332076.7 // 虚拟机存储空闲资源
      },
      "phyResources": {
        "hostCount": 36, //		物理机总数
        "storgeCount": 38, //	存储总数
        "resourcePoolCount": 1, //资源池
        "netWorkCount": 9 //	网络
      },
      "cloudInstanceId": "600da240e4b0fbef100d80ef",
      "cloudResources": {
        "vmCpuCount": 1612.0,
        "vmDiskSize": 314.2369,
        "vmMemSize": 7190.453,
        "vmCount": 219
      }
    },
    "code": 0
  }
  // 此处省略对data的一系列运算
  return {
    data: data
  }
}


const hWStackInfo = function () {
  let data = {
    "msg": "success",
    "result": {
      "resourcesUse": {
        "storgeCapacitySize": 13060.0,
        "hostCpuCount": 5614.0,
        "hostMemSize": 8.0194464E7,
        "vmCpuCount": 4742.0,
        "vmDiskSize": 800.0,
        "vmMemSize": 1.6446164E7,
        "storgeFreeSize": 12260.0
      },
      "phyResources": {
        "hostCount": 106,
        "storgeCount": 867,
        "resourcePoolCount": 10,
        "netWorkCount": 98
      },
      "cloudInstanceId": "6011b81de4b05cbf63964f76",
      "cloudResources": {
        "vmCpuCount": 5548.0,
        "vmDiskSize": 213132.0,
        "vmMemSize": 1.34656E7,
        "vmCount": 473
      }
    },
    "code": 0
  }
  // 此处省略对data的一系列运算
  return {
    data: data
  }
}

const vdcCount = function () {
  const data = {
    "msg": "success",
    "code": 0,
    "count": 46
  }
  return data
}


const projectCount = function () {
  const data = {
    "msg": "success",
    "code": 0,
    "count": 46
  }
  return data
}





// url是真实的url，第二个参数是post和get都管，第三个参数就是传入函数对象
Mock.mock('/api/resource/collector/statistics/getCloudInfo', /post|get/i, CloudInfo);
Mock.mock('/api/resource/collector/statistics/vmware', /post|get/i, vmwareInfo);
Mock.mock('/api/resource/collector/statistics/hWStack', /post|get/i, hWStackInfo);
Mock.mock('/api/resource/HW_CLOUD_TENANT_PROJECT_VDC/count', /post|get/i, projectCount);
Mock.mock('/api/resource/HW_CLOUD_TENANT_VDC/count', /post|get/i, vdcCount);
Mock.mock('/api/resource/collector/statistics/BUSINESS/queryList', /post|get/i, cloud);
Mock.mock('/api/resource/collector/statistics/_BIGSTATISTICS/queryList', /post|get/i, cloud);

